<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<%@include file="../common/selfCss.jsp"%>

<script type="text/javascript">
<!--
	//添加新频道
	function addClass() {
		var type =$("#type").val();
		var name = $.trim($("#name").val());
		if(name==""){
			$.ligerDialog.warn("请填写频道名称！");
			return;
		}else if(type==""){
			$.ligerDialog.warn("出错了！");
			return;
		}
		$("#addClass").attr("onclick","");
		$.post("/misc/artPic/cmsSaveClass.htm",{
			name : name,
			parent : ${parentVal},
			type:type
		},function(data){
			if (data == "success") {
				alert("添加成功,请刷新页面！");
				//window.open("/misc/artPic/picGround.htm");
			}else{
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
	}
	function showUpdate(id,name){
		$("#updateId").val(id);
		$("#updateName").val(name);
		$("#updateClass").show();
	}
	function updateClass(id){
		var name = $.trim($("#updateName").val());
		if(name==""){
			alert("请填写频道名称！");
			return;
		}
		$.post("/misc/cms/editchannel.htm",{
			identifier:$("#updateId").val(),
			name : $("#updateName").val()
		},function(data){
			if (data == "success") {
				alert("更新,请刷新页面！");
			}else{
				$.ligerDialog.warn("系统有点抽经，请稍候重试！");
			}
		});
	}
	
	function deleteClass(id){
		$.post("/misc/artPic/deleteClassList.htm", {
			identifier : id
		}, function(data) {
			if (data == 'success') {
				alert("作废成功！");
			}
		});
	}
//-->
</script>

<style>
	.def_t td{border:1px solid #ccc; padding:5px;}
	.input_middle{font-family:tahoma;}
	.input_middle label{vertical-align:middle;cursor:pointer}
	.input_middle input{vertical-align:middle;margin-right:3px;}
</style>

<br>
<br>
<br>
<br>
<table width="90%">
		<tr>
			<td>
			<c:if test="${type eq '700'}">标签</c:if><c:if test="${type eq '600'}">价格</c:if><c:if test="${type eq '100'}">尺寸</c:if><c:if test="${type eq '200'}">材料</c:if><c:if test="${type eq '300'}">年代</c:if><c:if test="${type eq '400'}">用途</c:if><c:if test="${type eq '500'}">环境</c:if>分类：
			</td>
			<td >
			<div class="input_middle">
				<c:forEach items="${classList}" var="list" varStatus="vs">
					<span style="color: blue">[${vs.count}]</span>&nbsp;&nbsp;<span <c:if test="${!list.enabled}">style="color: #D1EEEE"</c:if>>${list.name}</span>&nbsp;&nbsp;<a href="#" onclick="showUpdate('${list.identifier}','${list.name}')"><span style="color:#FF00FF">修改</span></a>&nbsp;&nbsp;
					<input onclick="deleteClass('${list.identifier}')" value="作废" type="button"/>
					<c:if test="${vs.count %5 ==0 }"><br></c:if>
				</c:forEach>
			</div>
				<input type="hidden" value="${type}" id="type"/>
				
			</td>
		</tr>
		<tr>
			<td>添加<c:if test="${type eq '600'}">价格</c:if><c:if test="${type eq '100'}">尺寸</c:if><c:if test="${type eq '200'}">材料</c:if><c:if test="${type eq '300'}">年代</c:if><c:if test="${type eq '400'}">用途</c:if><c:if test="${type eq '500'}">环境</c:if>名称：
			</td>
			<td>
				<input type="text" id="name" style="border:1px solid #a3c0e8; padding:3px 5px;width: 350px;">
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
				<button type="button" style="padding:2px 20px;" id="addClass" onclick="addClass()">保存</button>
			</td>
		</tr>	
</table>
* <span style="color: #D1EEEE" >颜色</span>表示已作废
<br>
<br>
<br>

		<div style="text-align: center; display: none;" id="updateClass" >
			<table width="40%">
				<tr>
					<td colspan="2" align="center">
							<input type="text" id="updateName" style="border:1px solid #a3c0e8; padding:3px 5px;width: 350px;">
							<input type="hidden"  id="updateId"/>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<button type="button" style="padding:2px 20px;"   onclick="updateClass()">修改</button>
					</td>
				</tr>	
			</table>
		</div>


